package com.skytech.component.crawler.scratch;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface CrawlerUrlDAO extends JpaRepository<CrawlerUrl,String> {
    List<CrawlerUrl> findByRuleId(String ruleId);

    void deleteByRuleId(String ruleId);

    Page<CrawlerUrl> findByRuleId(String ruleId, Pageable pageable);

    @Query(value = "select count(*) from crawler_url u where u.rule_id=:ruleId group by u.rule_id",nativeQuery = true)
    Integer findGroupByRuleId(@Param("ruleId") String ruleId);

  //  Page<CrawlerUrl> findByRuleId(Integer page,Integer size,String ruleId);



}
